fix: RandomForestEstimator honors random_seed config#1547
Merged
Conversation
thinkall
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
Migrate
RandomForestEstimatorfrom a hardcodedrandom_state=12032022inconfig2paramsto therandom_seed-aware pattern used by the recently fixed estimators (#1364, #1374, #1376, #1541, #1546).Before this change, callers passing
AutoML(random_seed=N).fit(...)would get the same internalRandomForest/ExtraTreesrandom_state(always12032022) regardless ofN, inconsistent with howCatBoostEstimator,ElasticNetEstimator,SVCEstimator,SGDEstimator, andLRL1Classifieralready behave. This bringsRandomForestEstimatorand the inheritingExtraTreesEstimatorin line with the rest of the audited estimator family.The default value is preserved (
12032022), so the existing reproducibility tests forrfandextra_treeintest/automl/test_classification.pyandtest/automl/test_regression.pycontinue to pass unchanged.Related issue number
Tracking issue: #1540
Pattern reference: #1541 (SGD), #1546 (LRL1)
Test plan
pytest test/automl/test_classification.py test/automl/test_regression.py -k "reproducibility and (rf or extra_tree)"— 8/8 passpre-commit run --files flaml/automl/model.py— all hooks passChecks